from django.db import models
# 时间模块快
from django.utils import timezone


# Create your models here.

class Type(models.Model):
    type = models.CharField(max_length=50)

    class Meta:
        db_table = 'type'


class Test(models.Model):
    # 问题
    question = models.CharField(max_length=300)
    # 参考答案
    answer = models.TextField(null=True)
    # 给定答案
    reply = models.TextField(null=True)
    # 是否通过      0未通过  1已通过
    is_right = models.IntegerField(default=0)
    # 问题类型
    type = models.ForeignKey(Type, on_delete=models.SET_NULL, null=True)
    # 创建时间
    create_time = models.DateTimeField(default=timezone.now, null=True)  # 添加数据时，自动写入当前添加时间
    # 逻辑删除
    is_delete = models.IntegerField(default=0)  # 逻辑关联删除字段({0:未删除,1:已删除})

    class Meta:
        db_table = 'test'
